///*
// * Copyright (c) 2020 hebeiyiliuba.com
// * All rights reserved.
// *
// */
//package org.jeecg.modules.middleware.quartz.job.lnupload;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import org.apache.commons.collections4.CollectionUtils;
//import org.jeecg.modules.wlhy.report.ShippingNoteApiAlct56Service;
//import org.jeecg.modules.wlhy.shipping.entity.HyShippingNote;
//import org.jeecg.modules.wlhy.shipping.service.IHyShippingNoteService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.List;
//
///**
// * 辽宁运单补充税务上报脚本
// *
// * @author duanlikao
// * @created 2021/07/13
// */
//@Service
//public class LnUploadJobService {
//    private static final Logger LOGGER = LoggerFactory.getLogger(LnUploadJobService.class);
//
//    @Autowired
//    private IHyShippingNoteService shippingNoteService;
//
//    @Autowired
//    private ShippingNoteApiAlct56Service shippingNoteApiAlct56Service;
//
//    public SimpleDateFormat now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
//    /**
//     * 已支付运单同步价格
//     */
////    @Scheduled(cron = "0 0 0/1 * * ?") //每小时执行一次
//    public  void  autoLnUploadShippingNote(){
//      Long start = System.currentTimeMillis();
//      LOGGER.info("UploadJobService autoLnUploadShippingNote:执行运单同步价格数据开始" + now.format(new Date()));
//      QueryWrapper<HyShippingNote> queryWrapper = new QueryWrapper();
//      queryWrapper.eq("shipping_pay_status","6");
//      queryWrapper.eq("alct_identification","1");
//      queryWrapper.orderByDesc("pay_dt");
//
//        Page <HyShippingNote> page = new Page<>(1, 500);
//        IPage <HyShippingNote> pageList = shippingNoteService.page(page, queryWrapper);
//        List<HyShippingNote>    shippingNotes = pageList.getRecords();
//     // List<HyShippingNote> shippingNotes =  shippingNoteService.list(queryWrapper);
//      if(CollectionUtils.isNotEmpty(shippingNotes)){
//          for(HyShippingNote hyShippingNote:shippingNotes){
//              try {
//                  shippingNoteApiAlct56Service.updatePrice(hyShippingNote);
//              }catch (Exception e){
//                  LOGGER.info("UploadJobService autoLnUploadShippingNote:Exception : {}" ,e.getMessage());
//                  continue;
//              }
//          }
//      }
//      LOGGER.info("UploadJobService autoLnUploadShippingNote:执行运单同步价格数据结束,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
//
//    }
//
//    /**
//     * 签收运单同步运单轨迹
//     */
////    @Scheduled(cron = "0 0 0/1 * * ?") //每小时执行一次
//    public  void  autoSynTracesShippingNote(){
//        Long start = System.currentTimeMillis();
//        LOGGER.info("UploadJobService autoSynTracesShippingNote:执行同步运单轨迹数据开始" + now.format(new Date()));
//        QueryWrapper<HyShippingNote> queryWrapper = new QueryWrapper();
//        queryWrapper.eq("shipping_status","5");
//        queryWrapper.eq("alct_identification","1");
//        queryWrapper.orderByDesc("status_dt_sign");
//
//        Page <HyShippingNote> page = new Page<>(1, 500);
//        IPage <HyShippingNote> pageList = shippingNoteService.page(page, queryWrapper);
//        List<HyShippingNote>    shippingNotes = pageList.getRecords();
//        if(CollectionUtils.isNotEmpty(shippingNotes)){
//            for(HyShippingNote hyShippingNote:shippingNotes){
//                try {
//                    shippingNoteApiAlct56Service.synTraces(hyShippingNote);
//                }catch (Exception e){
//                    LOGGER.info("UploadJobService autoSynTracesShippingNote:Exception : {}" ,e.getMessage());
//                    continue;
//                }
//            }
//        }
//        LOGGER.info("UploadJobService autoSynTracesShippingNote:执行同步运单轨迹数据结束,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
//
//    }
//
//
//}
